package services

import (
	"api_server/internal/models"
	"time"

	"jihe.common/protos/base_server/proto"
)

func FullFashionList(in *proto.BaseGetFashionListRes) (out models.FashionList) {
	out.Total = int(in.Total)
	out.Page = int(in.Page)
	out.PageSize = int(in.PageSize)
	for _, v := range in.List {
		createTime, _ := time.ParseInLocation("2006-01-02 15:04:05", v.CreatedAt, time.Local)
		out.List = append(out.List, models.Fashion{
			BaseFashion: v,
			IsNew:       time.Now().Unix()-createTime.Unix() < 24*3600*7,
		})
	}
	return
}
